Skip to content

Conversation

@chuckwagoncomputing
Copy link
Contributor

@chuckwagoncomputing chuckwagoncomputing commented Oct 23, 2025

I'm creating this draft PR to get feedback before I polish things that I shouldn't do in the first place.

The first two commits are fixing the indentation and converting to posix line endings. If you would prefer not to change these things, let me know and I can rebase without them.

This adds up to 3 clockinfos below the date/weather text, shifting the time and date/weather text upwards.

I also moved one of the mountains a bit for background contrast when all 3 clockinfos are present.

Because the clockinfos are not very large, I created a second view for editing them to allow more room for swipes. This view is accessed by tapping, or by long-tapping on the Bangle.js 2 to reduce accidental activation. I guess this view could have been put in the settings screen, but I did it this way for two reasons which I am not certain about and am open to feedback.

  1. Convenience - people might not change their clockinfos often, but it sure is handy for initial setup.
  2. I'm not sure if a custom UI as the settings for an app is acceptable, as all the apps that I use just have menus as their settings.

App manager: https://chuckwagoncomputing.github.io/BangleApps/

TODO/Known issues:

  • Should probably update all the screenshots
  • A few times the edit screen has shown with the wrong clockinfos. I don't know how to reproduce this, and I've made quite a few changes since the last time I saw it, so it might be fixed.
  • clockinfosMain seems like pretty dumb data structure design, but I haven't decided on a solution yet. I don't want to just tag data.rows because I don't want to persist the shown state. How do objects compare to arrays in Espruino in terms of performance?

@chuckwagoncomputing
Copy link
Contributor Author

  • clockinfosMain seems like pretty dumb data structure design, but I haven't decided on a solution yet. I don't want to just tag data.rows because I don't want to persist the shown state. How do objects compare to arrays in Espruino in terms of performance?

I did some benchmarking:

var foo = [[],[],[false, false,true]];
var bar = [[true]];
var baz = {2: {2: true}}
let t = Date.now(); for (let i = 0; i < 1000; i++) { let s = foo[2][2] }; console.log(Date.now() - t);
t = Date.now(); for (let i = 0; i < 1000; i++) { let s = bar[0][0] }; console.log(Date.now() - t);
t = Date.now(); for (let i = 0; i < 1000; i++) { let s = baz[2][2] }; console.log(Date.now() - t);

foo takes 11 bytes of memory and 511 ms to complete the loop
bar and baz take 5 bytes and 496 ms to complete the loop

So objects are the winner; change incoming

@bobrippling
Copy link
Collaborator

The first two commits are fixing the indentation and converting to posix line endings. If you would prefer not to change these things, let me know and I can rebase without them.

Sounds good, thanks for splitting them up like that :)

Because the clockinfos are not very large, I created a second view for editing them to allow more room for swipes [...] I guess this view could have been put in the settings screen, but I did it this way for two reasons which I am not certain about and am open to feedback.

Yes - I think having it in settings would be better, as people are used to navigating to there to configure their clocks (etc), but I don't mind strongly so I'll let you decide, given you've been using the app for a while now. Another point is that the setting code loads every time the clock does, whereas if it were in settings, your clock would be faster to startup.

A few times the edit screen has shown with the wrong clockinfos. I don't know how to reproduce this, and I've made quite a few changes since the last time I saw it, so it might be fixed.

I suspect it is fixed, I can't find any problems with that kind of stuff in the code

@chuckwagoncomputing
Copy link
Contributor Author

OK, I've moved the clockinfo config to settings. There's an odd bug though.
Occasionally when tapping the back button, it acts as though I tapped on the messages widget, which is hidden.

@bobrippling
Copy link
Collaborator

Weird - if you edit the messages widget on your device (via the IDE), and change this code to print some logs about those dimensions it's looking at, what do you see?

}, touch: function(b, c) {
var w = WIDGETS["messages"];
if (!w || !w.width || c.x<w.x || c.x>w.x+w.width || c.y<w.y || c.y>w.y+24) return;
require("messages").openGUI();
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants